<%--/*
- * @description: 个人主页
- * @author: huangchuting
- * @update: huangchuting (2021/1/9 18:47)
- */--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link rel="stylesheet" href="/static/css/user-news.css">
<script type="text/javascript" src="/static/js/changeDiv.js"></script>
<html>
<head>
    <title>个人主页</title>
</head>
<body>
    <c:import url="../public/head.jsp"></c:import>
    <script>
        shop.innerHTML = '<span>·&#12288;个人主页</span>'
    </script>
    <div class="divWarp">
        <div class="contentWarp">
            <div class="nav">
                <div class="userImg">
                    <img src="/static/images/user/user.png"><br>
                    <p>${userNews.user_name}</p>
                </div>
                <div class="navNewWarp">
                    <ul>
                        <li id="navUser" class="navNew"><a href="javascript:HideOrShowFont3('navUser','navOrder','navPublish')" onclick="change_div3('conUser', 'conOrder', 'conPublish')"><img src="/static/images/public/navUser.png" class="navImg"> 个人详情</a></li>
                        <li id="navOrder" class="navNew"><a href="javascript:HideOrShowFont3('navOrder','navUser','navPublish')" onclick="change_div3('conOrder', 'conUser', 'conPublish')"><img src="/static/images/public/navOrder.png" class="navImg">订单中心</a></li>
                        <li id="navPublish" class="navNew"><a href="javascript:HideOrShowFont3('navPublish','navOrder','navUser')" onclick="change_div3('conPublish', 'conOrder', 'conUser')"><img src="/static/images/public/navPublish.png" class="navImg">我的发布</a></li>
                    </ul>
                </div>
            </div>
            <div class="content" id="conUser">
                <form class="updateForm" method="post" action="/User/updateUser">
                    <h2>个人详细信息</h2>
                    <table class="updataTable">
                        <input type="hidden" value="${userNews.user_id}" name="user_id"/>
                        <tr>
                            <td>用户编号：</td>
                            <td>${userNews.user_id}</td>
                        </tr>
                        <tr>
                            <td> &nbsp;&nbsp; 用户名：</td>
                            <td><input type="text" name="user_name" value="${userNews.user_name}"></td>
                        </tr>
                        <tr>
                            <td>用户电话：</td>
                            <td><input type="text" name="phone" value="${userNews.phone}"></td>
                        </tr>
                        <tr>
                            <td>用户密码：</td>
                            <td><input type="text" name="password" value="${userNews.password}"></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><input type="submit" value="更改个人信息" class="upBtn"></td>
                        </tr>
                    </table>
                </form>
            </div>
            <div class="content" id="conOrder">
                <h2>订单中心</h2>
                <table class="orderTable">

                    <tr>
                        <th>订单编号</th>
                        <th>商品名称</th>
                        <th>订单价格</th>
                        <th>当前状态</th>
                        <th>操作</th>
                    </tr>
                    <tr>
                        <td colspan="5">
                            <hr style="height:2px;border:none;border-bottom:1px solid #127698;">
                        </td>
                    </tr>
                   <c:forEach items="${ordersList}" var="var" varStatus="vs">
                        <tr>
                            <td><a href="/Order/orderCommit?order_id=${var.order_id}">${var.order_id}</a></td>
                            <td>${var.item_name}</td>
                            <td>${var.order_price}</td>

                            <c:if test="${var.order_state==1}">
                                <td><span style="color: crimson">[未完成]</span></td>

                            </c:if>
                            <c:if test="${var.order_state==0}">
                                <td><span>[已完成]</span></td>
                            </c:if>
                            <td>
                                <c:if test="${var.order_state==1}">
                                <a href="/Order/userDeleteOrder?order_id=${var.order_id}"><div class="orderBtn">删除订单</div></a>
                                </c:if>
                                <c:if test="${var.order_state==0}">
                                <div class="orderBtn" style="background: darkgray">删除订单</div>
                                </c:if>

                                <a href="#"><div class="orderBtn">联系卖家</div></a>

                        </tr>
                    </c:forEach>
                </table>
            </div>
            <div class="content" id="conPublish">
                <h2>我的发布</h2>
                <table class="OrderTable">
                    <tr>
                        <th>商品编号</th>
                        <th>商品名称</th>
                        <th>类型</th>
                        <th>价格</th>
                        <th>当前状态</th>
                        <th>操作</th>
                    </tr>
                    <td colspan="6">
                        <hr style="height:2px;border:none;border-bottom:1px solid #127698;">
                    </td>
                    <c:forEach items="${itemList}" var="var" varStatus="vs">
                        <tr>
                            <td><a href="/Item/item-news?item_id=${var.item_id}">${var.item_id}</a></td>
                            <td>${var.item_name}</td>
                            <td>${var.type}</td>
                            <td>${var.price}</td>

                            <c:if test="${var.item_state==1}">
                                <td><span style="color: crimson">[未售出]</span></td>

                            </c:if>
                            <c:if test="${var.item_state==0}">
                                <td><span>[已售出]</span></td>
                            </c:if>
                            <td>
                                <c:if test="${var.item_state==1}">
                                    <a href="/Item/deleteItem?item_id=${var.item_id}"><div class="orderBtn">删除商品</div></a>
                                    <a href="/Item/goUpdateItem?item_id=${var.item_id}"><div class="orderBtn">修改信息</div></a>
                                </c:if>
                                <c:if test="${var.item_state==0}">
                                    <div class="orderBtn" style="background: darkgray">删除商品</div>
                                    <div class="orderBtn" style="background: darkgray">修改信息</div>
                                </c:if>

                        </tr>
                    </c:forEach>
                </table>
            </div>
        </div>
    </div>
</body>
</html>